package com.mxpio.erp.common.inventory.service;

import java.math.BigDecimal;
import java.util.Collection;
import java.util.Map;

import com.mxpio.erp.common.inventory.entity.Lot;
import com.mxpio.erp.common.jpa.entity.BizNoticeType;
import com.mxpio.erp.common.jpa.model.Notice;
import com.mxpio.erp.common.jpa.model.Order;
import com.mxpio.erp.common.vo.InvFlowSummaryVo;
import com.mxpio.erp.common.vo.OrderExcuteLineVo;
import com.mxpioframework.system.service.BaseService;
import org.springframework.transaction.annotation.Transactional;

public interface LotService extends BaseService<Lot> {
	
	public Lot getNewLot(Order order, OrderExcuteLineVo vo);
	
	public Lot getNewLot(Notice notice, OrderExcuteLineVo vo, Map<String, BizNoticeType> typesMap);

	public BigDecimal getStock(String whCode, String itemCode, String lotNo,String subLotIndex,boolean excludeHold);

	public BigDecimal getMaxQuantityByWo(String woBizNo, String woBizLineNo);

	/**
	 * 获取已执行批次
	 * @param bizNo
	 * @param lineNo
	 * @param accessType
	 * @param whCode
	 * @return
	 */
	public Collection<InvFlowSummaryVo> getExecutedInvFlows(String bizNo, String lineNo, String accessType, String whCode);

    @Transactional(readOnly = true)
    BigDecimal getItemLiveStock(String whCode, String itemCode);

	@Transactional(readOnly = true)
	BigDecimal getItemLiveStockWithLotStatus(String whCode, String itemCode,boolean excludeHold);

	@Transactional(readOnly = true)
	Integer getCountByLotNo(String lotNo);


	@Transactional(readOnly = false)
	Lot splitNewLot(String lotNo, String originSubLotIndex, Integer holdIndex);
}
